www.gusucode.com > 有监督的 CNN 网络完成对MNIST 数字的识别 > 有监督的 CNN 网络完成对MNIST 数字的识别/CNN—卷积神经网络数字识别/rand_std.m

    function out = rand_std(w, h, numinp) 
%rand_std使用随机Levenberg-Marquardt % rand_std来进行卷积神经网络训练
%
%语法
%
%(cnet,perf_plot]=train(cnet、Ip、labels)
%
%描述
%输入:
% cnet——卷积神经网络类对象
% Ip -细胞数组,包含预处理的图像handwriten位数
% labels-单元阵列的标签,标签对应于图像
%输出:
% cnet——卷积神经网络训练
% perf_plot——表现数据

  sigma = numinp^(-1/2);
  out = (rand(w,h) - ones(w,h)/2);

  if(w*h>1)
    outstd = mean(std(reshape(out,1,[])));      

  else
      outstd=1;
  end
  out = out*sigma/outstd;